home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Video
/
World of Video.iso
/
datafiles
/
gfx_formats
/
rle
/
rle.ps
< prev
next >
Wrap
Text File
|
1995-02-13
|
68KB
|
2,475 lines
%!
%!
/md 200 dict def md begin /av 13 def /mtx matrix currentmatrix def /s30 30
string def /s1( )def /pys 1 def /pxs 1 def /pyt 760 def /pxt 29.52 def /por
true def /xl{translate}def /fp{pnsh 0 ne pnsv 0 ne and}def /vrb[{fp{gsave 1
setlinewidth pnsh pnsv scale stroke grestore}if newpath}{eofill}{eofill}
{newpath}{eofill}{eofill}{initclip eoclip newpath}{}{}{}{}]def /xdf{exch def}
def currentscreen /spf xdf /rot xdf /freq xdf /doop{vrb exch get exec}def /psu
{2 index .72 mul exch div /pys xdf div .72 mul /pxs xdf 36 sub /pyt xdf 36 sub
/pxt xdf /por xdf}def /txpose{dup 1680 eq{{1320 1680 div dup scale}if}dup 1212
eq{54 32.4 xl}if 1321 eq{8.64 -.6 xl}if pxs pys scale pxt pyt xl por not{270
rotate}if 1 -1 scale}def /obl{{0.212557 mul}{pop 0}ifelse}def /sfd{[ps 0 ps 6
-1 roll obl ps neg 0 0]makefont dup setfont}def /fnt{findfont sfd}def /bt{1
index and 0 ne exch}def /sa 6 array def /fs{1 bt 2 bt 4 bt 8 bt 16 bt sa astore
pop}def /matrix1 matrix def /matrix2 matrix def /gf{currentfont}def /tc{32768
div add 3 1 roll 32768 div add 2t astore pop}def /3a[0 0 0]def /2t 2 array def
/tp{3a astore pop}def /ee{}def /tt{gsave currentpoint 2 copy 2t aload pop qa 2
copy xl 3a aload pop exch dup 0 eq{pop}{1 eq{-1 1}{1 -1}ifelse scale}ifelse
rotate pop neg exch neg exch xl moveto}def /te{currentpoint currentfont
grestore setfont moveto}def /tb{/tg currentgray def 3 -1 roll 3 eq{1 setgray}
if /ml 0 def /al 0 def}def /am{ml add /ml xdf}def /aa{[currentgray /setgray cvx
]cvx exch dup wi pop dup al add /al xdf exch}def /th{3 -1 roll div 3 1 roll
exch div 2 copy matrix1 transform scale pop scale /scaleflag true def}def /tu{
1 1 matrix1 itransform scale /scaleflag false def}def /ts{1 1 matrix1 transform
scale /scaleflag true def}def /fz{/ps xdf}def /fx{dup exec}def /st{show pop pop
}def /tm{{dup type dup /integertype eq exch /realtype eq or{dup ml mul}{dup
type /stringtype eq{rs}{dup type /dicttype eq{setfont}{dup type /arraytype eq
{exec}{pop}ifelse}ifelse}ifelse}ifelse}forall}def /es{3 -1 roll dup sa 5 get
dup type /nulltype eq{pop4 pop}{sa 1 get{/ml ml .2 ps mul sub def}if ne{fs}
{pop}ifelse exch dup 1 eq{pop al ml gt{/tv{ll}/ml ml al dup 0 ne{div}{pop}
ifelse def}{/tv{st}/ml 1 def}ifelse def tm}{dup 3 eq{pop al ml gt{/tv{ll}/ml ml
al dup 0 ne{div}{pop}ifelse def}{ml al sub 0 rmoveto /tv{st}/ml 1 def}ifelse
def tm}{2 eq{al ml gt{/tv{ll}/ml ml al dup 0 ne{div}{pop}ifelse def}{ml al sub
2 div 0 rmoveto /tv{st}/ml 1 def}ifelse def tm}{/tv{ll}def /ml ml al dup 0 ne
{div}{pop}ifelse def tm}ifelse}ifelse}ifelse}ifelse tg setgray}def /pop4{pop
pop pop pop}def /gm{scaleflag{matrix1 itransform}if moveto}def /ly{exch pop
currentpoint exch pop sub 0 exch rmoveto}def /page{pop}def /sk{systemdict
/statusdict known}def /jn{sk{statusdict /jobname 3 -1 roll put}{pop}ifelse}def
/pen{/pnsv xdf /pnsh xdf pnsh setlinewidth}def /dlin{currentpoint newpath
moveto lineto currentpoint stroke grestore moveto}def /lin{currentpoint /pnlv
xdf /pnlh xdf gsave newpath /@y xdf /@x xdf fp{pnlh @x lt{pnlv @y ge{pnlh pnlv
moveto @x @y lineto pnsh 0 rlineto 0 pnsv rlineto pnlh pnsh add pnlv pnsv add
lineto pnsh neg 0 rlineto}{pnlh pnlv moveto pnsh 0 rlineto @x pnsh add @y
lineto 0 pnsv rlineto pnsh neg 0 rlineto pnlh pnlv pnsv add lineto}ifelse}
{pnlv @y gt{@x @y moveto pnsh 0 rlineto pnlh pnsh add pnlv lineto 0 pnsv
rlineto pnsh neg 0 rlineto @x @y pnsv add lineto}{pnlh pnlv moveto pnsh 0
rlineto 0 pnsv rlineto @x pnsh add @y pnsv add lineto pnsh neg 0 rlineto 0 pnsv
neg rlineto}ifelse}ifelse closepath fill}if @x @y grestore moveto}def /dl{
gsave 0 setlinewidth 0 setgray}def /barc{/@f xdf /@op xdf /@e xdf /@s xdf /@r
xdf /@b xdf /@l xdf /@t xdf gsave @r @l add 2 div @b @t add 2 div xl 0 0 moveto
@r @l sub @b @t sub mtx currentmatrix pop scale @f{newpath}if 0 0 0.5 @s @e arc
mtx setmatrix @op doop grestore}def /doarc{dup 0 eq barc}def /doval{0 exch 360
exch true barc}def /dorect{/@op xdf currentpoint 6 2 roll newpath 4 copy 4 2
roll exch moveto 6 -1 roll lineto lineto lineto closepath @op doop moveto}def
/mup{dup pnsh 2 div le exch pnsv 2 div le or}def /dorrect{/@op xdf 2. div /@h
xdf 2. div /@w xdf /@r xdf /@b xdf /@l xdf /@t xdf @t @b eq @l @r eq @w mup or
or{@t @l @b @r @op dorect}{@r @l sub 2. div dup @w lt{/@w xdf}{pop}ifelse @b @t
sub 2. div dup @w lt{/@w xdf}{pop}ifelse @op 0 eq{/@w @w pnsh 2 div sub def}if
currentpoint newpath @r @l add 2. div @t moveto @r @t @r @b @w arcto pop4 @r @b
@l @b @w arcto pop4 @l @b @l @t @w arcto pop4 @l @t @r @t @w arcto pop4
closepath @op doop moveto}ifelse}def /pr{gsave newpath /pl{moveto /pl{lineto}
def}def}def /pl{lineto}def /ep{dup 0 eq{{moveto}{lin}{}{}pathforall pop
grestore}{doop grestore}ifelse}def /bs 8 string def /bd{/bs xdf}def /bit{bs
exch get exch 7 sub bitshift 1 and}def /bix{1 add 4 mul cvi}def /pp{exch bix
exch bix bit}def /grlevel{64. div setgray}def /setpat{/bs xdf 9.375 0{pp}
setscreen grlevel}def /setgry{freq rot{spf}setscreen grlevel}def /x4{2 bitshift
}def /d4{-2 bitshift}def /xf{.96 mul exch 2 sub .96 mul exch}def /dobits{
/bmode xdf save 9 1 roll{x4 /@dy xdf 2 sub x4 /@dx xdf /@idx xdf .96 mul exch 2
sub exch xl 0 0 moveto xf 0 2 2 index 4 index 1.759 add 10 dorect clip newpath
0 0 moveto scale bmode 0 eq bmode 4 eq or{1 setgray 1 @dy div 1 @dx div 1 1 2
dorect}if bmode 3 eq bmode 7 eq or{1}{0}ifelse setgray @idx 5 bitshift @dy
bmode 4 eq bmode 5 eq bmode 7 eq or or[@dx 0 0 @dy 0 0]{(%stdin)(r)file @dy d4
4 add @idx mul string readhexstring pop dup length @idx x4 sub 4 bitshift
string dup 3 1 roll @dx 8 add d4 smooth}imagemask}{/@dy xdf 2 sub /@dx xdf
/@idx xdf /@xs @idx string def /@f(%stdin)(r)file def /@p{@f @xs readhexstring
pop}def .96 mul xl 0 0 moveto xf scale 0 0 1 1 10 dorect clip newpath 0 0
moveto bmode 0 eq bmode 4 eq or{1 setgray .25 @dy div .25 @dx div 1 1 2 dorect
}if bmode 3 eq bmode 7 eq or{1}{0}ifelse setgray @p @p @idx 3 bitshift @dy
bmode 0 eq bmode 1 eq bmode 3 eq or or[@dx 0 0 @dy 0 0]{@p}imagemask @p @p pop4
}ifelse restore}def /mfont 14 dict def /wd 14 dict def /mdef{mfont wcheck not
{/mfont 14 dict def}if mfont begin xdf end}def /dc{transform round .5 sub exch
round .5 sub exch itransform}def /cf{{1 index /FID ne{tmp 3 1 roll put}{pop pop
}ifelse}forall}def /mv{tmp /Encoding macvec put}def /bf{mfont begin /FontType 3
def /FontMatrix[1 0 0 1 0 0]def /FontBBox[0 0 1 1]def /Encoding macvec def
/BuildChar{wd begin /cr xdf /fd xdf fd /low get cr get 2 get -1 ne{fd begin low
cr get aload pop sd low cr 1 add get 0 get sh sw end /sw xdf /sh xdf sw div
/clocn xdf dup 0 ne{0 exch sh div neg dc xl}{pop}ifelse exch sw div /coff xdf
exch sw div /cloc xdf /bitw clocn cloc sub def sw sh div 1 scale sw div 0 coff
0 bitw coff add 1 setcachedevice coff cloc sub 0 dc xl cloc .5 sw div add 0 dc
newpath moveto bitw 0 ne{0 1 rlineto bitw .5 sw div sub 0 rlineto 0 -1 rlineto
closepath clip sw sh false[sw 0 0 sh neg 0 sh]{fd /hm get}imagemask}if}if end}
def end mfont definefont pop}def /wi{save exch /show{pop}def stringwidth 3 -1
roll restore}def /aps{0 get 124 eq}def /apn{s30 cvs aps}def /xc{s30 cvs dup
}def /xp{put cvn}def /scs{xc 3 67 put dup 0 95 xp}def /sos{xc 3 79 xp}def /sbs
{xc 1 66 xp}def /sis{xc 2 73 xp}def /sob{xc 2 79 xp}def /sss{xc 4 83 xp}def /dd
{exch 1 index add 3 1 roll add exch}def /smc{moveto dup show}def /kwn{dup
FontDirectory exch known{findfont exch pop}}def /fb{/ps ps 1 add def}def /mb
{dup sbs kwn{exch{pop}{bbc}{}mm}ifelse sfd}def /mo{dup sos kwn{exch{pop}{boc}{
}mm}ifelse sfd}def /ms{dup sss kwn{exch{pop}{bsc}{}mm}ifelse sfd}def /ao{dup
sos kwn{exch dup ac pop{scs findfont /df2 xdf}{aoc}{}mm}ifelse sfd}def /as{dup
sss kwn{exch dup ac pop{scs findfont /df2 xdf}{asc}{}mm}ifelse sfd}def /ac{dup
scs kwn{exch /ofd exch findfont def /tmp ofd maxlength 1 add dict def ofd cf mv
tmp /PaintType 1 put tmp definefont}ifelse}def /mm{/mfont 10 dict def mfont
begin /FontMatrix[1 0 0 1 0 0]def /FontType 3 def /Encoding macvec def /df 4
index findfont def /FontBBox[0 0 1 1]def /xda xdf /mbc xdf /BuildChar{wd begin
/cr xdf /fd xdf /cs s1 dup 0 cr put def fd /mbc get exec end}def exec end mfont
definefont}def /bbc{/da .03 def fd /df get setfont gsave cs wi exch da add
exchd grestore setcharwidth cs 0 0 smc da 0 smc da da smc 0 da moveto show}def
/boc{/da 1 ps div def fd /df get setfont gsave cs wi exch da add exch grestore
setcharwidth cs 0 0 smc da 0 smc da da smc 0 da smc 1 setgray da 2. div dup
moveto show}def /bsc{/da 1 ps div def /ds .05 def /da2 da 2. div def fd /df get
setfont gsave cs wi exch ds add da2 add exch grestore setcharwidth cs ds da2
add .01 add 0 smc 0 ds da2 sub xl 0 0 smc da 0 smc da da smc 0 da smc 1 setgray
da 2. div dup moveto show}def /aoc{fd /df get setfont gsave cs wi grestore
setcharwidth 1 setgray cs 0 0 smc fd /df2 get setfont 0 setgray 0 0 moveto show
}def /asc{/da .05 def fd /df get setfont gsave cs wi exch da add exch grestore
setcharwidth cs da .01 add 0 smc 0 da xl 1 setgray 0 0 smc 0 setgray fd /df2
get setfont 0 0 moveto show}def /T true def /F false def /6a 6 array def /2a 2
array def /5a 5 array def /qs{3 -1 roll sub exch 3 -1 roll sub exch}def /qa{3
-1 roll add exch 3 -1 roll add exch}def /qm{3 -1 roll 1 index mul 3 1 roll mul
}def /qn{6a exch get mul}def /qA .166667 def /qB .833333 def /qC .5 def /qx{6a
astore pop qA 0 qn qB 2 qn add qA 1 qn qB 3 qn add qB 2 qn qA 4 qn add qB 3 qn
qA 5 qn add qC 2 qn qC 4 qn add qC 3 qn qC 5 qn add}def /qp{6 copy 12 -2 roll
pop pop}def /qc{qp qx curveto}def /qi{{4 copy 2a astore aload pop qa .5 qm
newpath moveto}{2 copy 6 -2 roll 2 qm qs 4 2 roll}ifelse}def /qq{{qc 2a aload
pop qx curveto}{4 copy qs qa qx curveto}ifelse}def /pt{gsave currentpoint
newpath moveto}def /qf{gsave eofill grestore}def /tr{currentgray currentscreen
bs 5a astore pop /fillflag 1 def}def /bc{/fillflag 0 def}def /ec{currentpoint 3
-1 roll 1 and 0 ne{currentgray currentscreen bs 5a aload pop bd setscreen
setgray 0 doop bd setscreen setgray}{newpath}ifelse moveto}def /bp{
currentpoint newpath 2 copy moveto currentgray currentscreen bs 5a astore pop}
def /eu{fillflag 0 ne{gsave currentgray currentscreen bs 5a aload pop bd
setscreen setgray 4 ep bd setscreen setgray}if fp{0 ep}{grestore newpath
}ifelse}def /sm{dup 0 exch{32 eq{1 add}if}forall}def /ll{3 1 roll exch dup
.0001 lt 1 index -.0001 gt and{pop pop pop}{sub dup 0 eq{pop show}{1 index sm
dup 0 eq 3 index 0 le or{pop length div 0 3 -1 roll ashow}{10 mul exch length
add div dup 10 mul 0 32 4 -1 roll 0 6 -1 roll awidthshow}ifelse}ifelse}ifelse
}def /ss{/pft currentfont def sa aload pop pop /|----2Symbol 4 1 roll{pop{as}}
{{{ao}}{{fnt}}ifelse}ifelse exch pop exec exch pop}def /pf{pft dup setfont}def
/rs{sa 2 get{gsave 1 index 0 currentfont dup /FontInfo known{/FontInfo get dup
/UnderlinePosition known{dup /UnderlinePosition get 1000 div ps mul}{ps 10 div
neg}ifelse exch dup /UnderlineThickness known{/UnderlineThickness get 1000 div
ps mul}{pop ps 15 div}ifelse}{pop ps 10 div neg ps 15 div}ifelse setlinewidth 0
setgray currentpoint 3 -1 roll sub moveto sa 4 get{gsave currentlinewidth 2.
div dup rmoveto currentpoint xl 2 copy rlineto stroke grestore}if sa 3 get sa 4
get or 3 1 roll 2 index{gsave 1 setgray 2 copy rlineto stroke grestore}if
rlineto{strokepath 0 setlinewidth}if stroke grestore}if tv}def /macvec 256
array def macvec 0 /Times-Roman findfont /Encoding get 0 128 getinterval
putinterval macvec 39 /quotesingle put /dotlessi /grave /circumflex /tilde
/cedilla /registerserif /copyrightserif /trademarkserif macvec 0 8 getinterval
astore pop /Adieresis /Aring /Ccedilla /Eacute /Ntilde /Odieresis /Udieresis
/aacute /agrave /acircumflex /adieresis /atilde /aring /ccedilla /eacute
/egrave /ecircumflex /edieresis /iacute /igrave /icircumflex /idieresis /ntilde
/oacute /ograve /ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex
/udieresis /dagger /ring /cent /sterling /section /bullet /paragraph
/germandbls /registersans /copyrightsans /trademarksans /acute /dieresis
/notequal /AE /Oslash /infinity /plusminus /lessequal /greaterequal /yen /mu
/partialdiff /summation /product /pi /integral /ordfeminine /ordmasculine
/Omega /ae /oslash /questiondown /exclamdown /logicalnot /radical /florin
/approxequal /Delta /guillemotleft /guillemotright /ellipsis /space /Agrave
/Atilde /Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright /quoteleft
/quoteright /divide /lozenge /ydieresis /Ydieresis /fraction /currency
/guilsinglleft /guilsinglright /fi /fl /daggerdbl /periodcentered
/quotesinglbase /quotedblbase /perthousand /Acircumflex /Ecircumflex /Aacute
/Edieresis /Egrave /Iacute /Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex
/apple /Ograve /Uacute /Ucircumflex /Ugrave /dotlessi /asciicircum /asciitilde
/macron /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron macvec
128 128 getinterval astore pop FontDirectory{exch dup s30 cvs /@s xdf @s aps
{pop pop}{exch dup length dict /tmp xdf cf /Symbol ne{mv}if /@i false def /@o
false def /@b false def mark @s(Italic)search{/@i true def}if(Oblique)search
{/@o true def}if(Bold)search{/@b true def}if(Roman)search pop(-)search pop /@s
xdf cleartomark @s cvn dup /Symbol eq{pop 50}{/Courier eq{51}{49}ifelse}ifelse
s30 0 @s length 6 add getinterval dup 6 @s putinterval dup 0(|-----)
putinterval @b{dup 1 66 put}if @i @o or{dup 2 73 put}if dup 5 4 -1 roll put cvn
tmp definefont pop}ifelse}forall /_--C-2Symbol /Symbol findfont /tmp 1 index
maxlength 1 add dict def cf tmp /PaintType 1 put tmp definefont /|----4Seattle
/Helvetica findfont dup length 1 add dict /tmp xdf cf mv /mxv[/zero /one /two
/three /four /five /six /seven /eight /nine /comma /period /dollar /numbersign
/percent /plus /hyphen /E /parenleft /parenright /space]def tmp /Metrics 21
dict dup begin mxv{600 def}forall end put tmp begin /FontBBox FontBBox[0 0 0 0
]astore def end tmp definefont pop /od{txpose 10 fz 0 fs F /|----3Courier fnt
pop}def /op{/scaleflag false def /pm save def}def /cp{pm restore}def end
<652E29AE551935C9A82086907FB876D510EC4D451220E0F80D63DBC0EA379346
C055B673F7BED773F332BDE5107DC0B1322DF36267320C226DBEBD9299B29C86
5D1876ABB7E19F6A45F52C588810FD0A9FFBB1073AD1B6BDCA3D2BAE3283AC88
35259ADDA98433676B8B757B19473F2C0C3D36AF93B3DD15AFC47F4D3BECB87B
ABAAB5613FCD319A712E7D4A8C5A3C0BA96A376CC93C52ABDE43A980670C1E6B
78E4D14D5CA032FE07255D5E5A084CCF4B8E23C64F574932EA53E8CD7F00F47B
4179A6DAFE3BC43B1D091902E6E4B5699C7322FC23B5FBE833E4114C4544E29E
6225A5B48E6F2A840F44E827681E1AC9F28EB8FEC32105CA4056D863BCAECE65
1AAF3B12BC38A77CA241A66FAE92939A6EFACD49711E5D7355E634041C378FFC
1F3BF8B903E5F8961E7480259EB0AA90B0C38E75D264ACE71F1307D4894BFDCF
9C9D0F3C026BA190A3F6F7E06F3ED092E8CF0D4F22AD6C55C6FED836290F9611
442BF4DEDBBA0B67D2AF782A796D474ECE7B2B788B4771D4BBCDF0E8F48A2874
D1CF78D3B1C5AA2987C6A22135B1508C7C5EC5AD86ABAE8D1E34A5314F703337
C7A2C0CF52DBBF046F0BD67BE5E65AAD9CE43FAB6E7C9F669801849C9366E5AE
76C77D8DDBF188CD18C120FEA4C1B510FC00434A2629BB82A9336EB36A5D5552
F4971ED40EF839771762E60509A2A3214DEA9C58C2E53E76CE24B99E3C472719
C66B31A38DE21135FF1390CCA7E0F6B92CEEAF9524317A427DA7CB9B4ED08BF0
9868FCD9ECAAFF2C520E0EAAB8730FD6CE85B4ACAEE82FC53C5D948C8858A8A3
CF945546556FB3DC9CE69D87BD793DAC57E3F4FB9D056C163C3EE134EDDF7B7D
186C9A0D79759CD9BF94A4B1E2A6070727DFC08806828B53799090725D4B2D6E
9BCB6C2B90AA4E47D1774F3A58868E4EB3464C7FB07854CE66E3AB03A5D515A1
69AC0EA62BAE9A2A419C9AAB14F09A864F4228A098FB288B60E87B85EB16A6D4
EF27B835BAC40E45BF48F78E6CE74AE0C1E81316F630BFE0D7661116B6A92187
9A1036437280BDA64F85CB37CA0DDBF827C3E4885F1C75E3C84CB8EBED892810
450DA08029A611AEE126FD6BEFF6830EDA28E4C54649D93C23270703B2F7FEAA
A6524192A2D7F1151B2827EF4B27C823D385EA683F024299B1EFE64871AFD4CD
6C54C484AA53030CC7F8254BF9E525A00E51867660A3409BECA98DEB37A568F6
D1026ECBFCCF8C9B9BFD11CE017CB2271E7BDEE1D459FFA23062D5B42552C04B
9BC02C0D7F5CC926ABE694A185FDE2ECC76506DEF1435CBC1225475E4D98A04C
2CF1DD03915DEB659BC23DE29A6E6734CF49CE39A1BF450A55B0F14D350E79B0
5C690B84003AB669678B3A416828F376F78946C44009A14A49ED90980B6E4589
56D188D9AC3FA7F781C8670C83B403B73237B6B0C2862C51C33D559C005D6C9D
D39914B79DBE81291EF8D7CE3EC844176FB7C08A6F344E26C0563C29FCC3B0CB
2CCCF9412832300CBCDE6BFF39A8804ACCB8375752EEECB1BBA0851ED8DF9E17
4A5C747E354402DE217C6A7DE35BDE29F50284F66EC5F9DC0032FE3E05842472
6F9E50555FCBEFF246264D503DCFEB5C5F3384798E5C622FD0450DC62DCE36CA
9007DBA236A7CE56A57C0B0C531AC5766684DE4BDD2DFEC3BA4D99B930B2EDB2
0C2AC0F032BB6E5C75AF97AE24DD7FF33FA0F643BBB39331E7E4A474ED5612A1
7AEF558F8281D4E9EC01AC3D04C4A4C4B8A67F7A6199BA35448298E177554A20
81DFA1E8D1BC88BDB9938CFEC498918BF3AD690924F295A03D17F28C5FF47F43
D495B74827BD54A2524F53750D4C030843986C97B59A63E08EFB9B14582088BA
FC257BCEF07F2E4B8DCADCC9FAEF7388055483470D5FA4A8CE8CC118CA91FAA5
B0DCCC7F3638A2F9F40628186990C2EE0E25B0FB34DAD8521A6735485ADBE4DD
7A937036C5EF7E741FF4543FDEE19DD0CFF59A89656F80F8E5E84C10878CB651
0DD3C3C7A346AC1877FFA88E5ADDCFF95D37163A5350AA5C71BB801ACB0D0FA1
154DE2C2D039CAAB85F389554044E8F90F9992DEBCCBEACE55F69E31061FB052
A25343ECBEDE16C8999218AF370378901B36655D83D4B9BC5F4F43B361BB2134
3A88E0350E5C4342407DEFA79877B3C5DAFE15B0F58520FDBE5B8362BE3549AE
03BD77CDFEC962C539252312ECC5D841F55BEBAD9F7BB03A2D2CAC844E82A568
7CB2D8E599E356D9A23802439B056F1CC104F9F0D3F01EE2593C59483154FCCA
3973F487593C9DE94FC0863B6669100B46AFC5B261493A4B50CB9F802EBC31AB
7B7903A1957EA078A0C4D90E204E44335131C9B65F15D3E5C9A87ADAA7FE5E49
D3654F021F460E5E2AC56A69E8F50E45B0D859D8EC27333DF2AE409015973D7E
ED59F45720DD271D081F3DF62032358E0D4B1D4A528FB4E96A6B2007E13E55E2
10DAED32AF76F3396D60295D116EC4EE4D42DF4BC764ED9BC11A369FE070815F
FEB5662551561354788EFA98612D09BC964428767E0CBE5DC3EC5B599E9B2074
AA3D446752A4E34485C3D111034676AF67EE5345263E883CF46C8BEF1BD4D51D
D2B625481880254888AB0C186E2D0549F657E59026E2A3C49FE0DFD2A2CAD076
586B6F248C11E81C41F9525A5D2F77CE5D76FD9104F39F4E4E31CF75045A9061
B16B20CDC2AFD0595F5B6ADF45CA0DC6A37C4ED090AADCFE9EA7847217777A8E
88C7FBC247EC02973EF656BF1A4A2E71ED21142EC48CC9FDBF5EAE8B46C3E477
59D9C304C6862D43AF1DE66B44B4AC18B47C6518FA5747D3D8C9A19612DAEE4E
83C141561421A1360FD847997148932568D3E6CA93BF0D5874BCD90A3A363739
1FAD35F574797D6160BD4F1AEC3A326D5D73C9BD699C41524B18BC6CDF9169E7
51FFAB19B9FD7ABE3B2F9D3E0F67ADB05CA85D484ACBC84E287DAA1EDC3BCD95
694EF05F77A59004B1C3E223AA4A5A063EC238B4A5A25D335FA51B165963621F
57B7F2C54E59CFED574370399A03E2DFB0F1E35678A6A509A912ED27AD755C67
E045CC1CFEFE41CAD8EA73DD666757D90170EF9C3F218120F38FC1D38224160E
7F5DE6BDF39665FF231079296B94A7DE674847D299C711E77C9DA408FF9CDCFA
8F7FE175BE275EB0AE21512D074DBDDCF1CDF75642EF656E2555F9F3E60A2822
F214CC81EEF0E4866387799F21B1F4B296E7F3A2206795457A33E85B397A5F20
10809D1F43B2267BD762A6CC12DF31BB0817496FE666A6955CD2BA96549B4D1F
827E54A835ABA03B1079F1F5C3C4D2F4F698D3C235BDFA829F079A0DCF788913
77B31EBACF4E61A01487ED1F80ABBF5CF000B1EAA8527EC6064AB06B921916CB
65045B86E9BB2D2E854C5124C218B6FDA0732ABF424EE1696BC86F8987E48CC5
038C8A557E9534A48E7C55F21F021AA7A370A7CC1B55E777972883433F454450
D18ABFC489D5AA518171884FB7103D92E479ECAEA449341F7C8DB1BD39ECB1ED
45AF5D9628EF37CAF8DB3C9A65856A97FB9698DD68F8BE27B3C4174F1838C7A0
674A9460333A059BF214C0690F35BC0352AF9B82CB0F46EAE63A3C0302B4118D
9E65479030F1EFE34909FA458E31A500483B68601B480D51B7FFCD004A1B5360
905B88019BC3EF0FF064AC6477442573C18EF7090E2C08EAA1A9> eexec
%!PS-Adobe-1.0
%%Title: rle.mss
%%DocumentFonts: (atend)
%%Creator: John W Peterson and Scribe 5(1501)
%%CreationDate: 8 November 1987 14:56
%%Pages: (atend)
%%EndComments
% PostScript Prelude for Scribe.
/BS {/SV save def 0.0 792.0 translate .01 -.01 scale} bind def
/ES {showpage SV restore} bind def
/SC {setrgbcolor} bind def
/FMTX matrix def
/RDF {WFT SLT 0.0 eq
{SSZ 0.0 0.0 SSZ neg 0.0 0.0 FMTX astore}
{SSZ 0.0 SLT sin SLT cos div SSZ mul SSZ neg 0.0 0.0 FMTX astore}
ifelse makefont setfont} bind def
/SLT 0.0 def
/SI { /SLT exch cvr def RDF} bind def
/WFT /Courier findfont def
/SF { /WFT exch findfont def RDF} bind def
/SSZ 1000.0 def
/SS { /SSZ exch 100.0 mul def RDF} bind def
/AF { /WFT exch findfont def /SSZ exch 100.0 mul def RDF} bind def
/MT /moveto load def
/XM {currentpoint exch pop moveto} bind def
/UL {gsave newpath moveto dup 2.0 div 0.0 exch rmoveto
setlinewidth 0.0 rlineto stroke grestore} bind def
/LH {gsave newpath moveto setlinewidth
0.0 rlineto
gsave stroke grestore} bind def
/LV {gsave newpath moveto setlinewidth
0.0 exch rlineto
gsave stroke grestore} bind def
/BX {gsave newpath moveto setlinewidth
exch
dup 0.0 rlineto
exch 0.0 exch neg rlineto
neg 0.0 rlineto
closepath
gsave stroke grestore} bind def
/BX1 {grestore} bind def
/BX2 {setlinewidth 1 setgray stroke grestore} bind def
/PB {/PV save def translate 100.0 -100.0 scale pop} bind def
/PE {PV restore} bind def
/SH /show load def
/MX {exch show 0.0 rmoveto} bind def
/W {0 32 4 -1 roll widthshow} bind def
/WX {0 32 5 -1 roll widthshow 0.0 rmoveto} bind def
%%EndProlog
%%Page: 0 1
BS
0 SI
15 /Times-Bold AF
20328 8205 MT
(Design of the Utah RLE Format)SH
10 /Times-Roman AF
26531 10411 MT
(Spencer W. Thomas)SH
19893 12840 MT
(University of Utah, Department of Computer Science)SH
13 /Times-Bold AF
28181 24323 MT
(Abstract)SH
9 /Times-Roman AF
9617 26627 MT
(The Utah RLE \050Run Length Encoded\051 format is designed to provide an efficient, device independent means)
5 W( of storing)4 W
9000 27641 MT
(multi-level raster images. Images of)
108 W( arbitrary size and depth can be saved. The design of the format is presented,)109 W
9000 28655 MT
(followed by descriptions of the library routines used to create and read RLE format files.)SH
12 /Times-Bold AF
7200 32339 MT
(1. Introduction)SH
10 /Times-Roman AF
8200 33444 MT
(The Utah RLE \050Run Length Encoded\051 format is designed to provide an efficient, device independent)
101 W( means of)100 W
7200 34549 MT
(storing multi-level raster images. It is not designed for binary \050bitmap\051 images. It is built on several)
11 W( basic concepts.)12 W
7200 35654 MT
(The central concept is that of a)120 W
/Times-Italic SF
20619 XM
(channel)SH
/Times-Roman SF
(. A)
488 W( channel corresponds to a single color, thus there are normally a red)119 W
7200 36759 MT
(channel, a green channel, and a blue channel. Up to 255 color channels are available for use; one)
178 W( channel is)179 W
7200 37864 MT
(reserved for "alpha" data.)
128 W( Although)
505 W( the format supports arbitrarily deep channels, the current implementation is)127 W
7200 38969 MT
(restricted to 8 bits per channel.)SH
8200 41176 MT
(Image data is stored in an RLE file in a scanline form, with the data)
107 W( for each channel of the scanline grouped)108 W
7200 42281 MT
(together. Runs)
342 W( of identical pixel values are compressed into a count)
46 W( and a value. However, sequences of differing)45 W
7200 43386 MT
(pixels are also stored efficiently \050not as a sequence of single pixel runs\051.)SH
8200 45593 MT
(The file header contains)
7 W( a large amount of information about the image, including its size, the number of channels)8 W
7200 46698 MT
(saved, whether it has an alpha channel, an optional color map, and comments.)
63 W( The)
374 W( comments may be used to add)62 W
7200 47803 MT
(arbitrary extra information to the saved image.)SH
8200 50010 MT
(A subroutine)
179 W( interface has been written to allow programs to read and write files in the RLE format. Two)180 W
7200 51115 MT
(interfaces are available, one that completely interprets the RLE file and returns scanline)
128 W( pixel data, and one that)127 W
7200 52220 MT
(returns a list of "raw")
37 W( run and pixel data. The second is more efficient, but more difficult to use, the first is easy to)38 W
7200 53325 MT
(use, but slower.)SH
8200 55532 MT
(The Utah RLE format has been)
90 W( used to save images from many sources, and to display saved images on many)89 W
7200 56637 MT
(different displays and from many different computers.)SH
12 /Times-Bold AF
7200 60321 MT
(2. Description of RLE Format)SH
10 /Times-Roman AF
8200 61426 MT
(All data in the RLE file is treated as a)
43 W( byte stream. Where quantities larger than 8 bits occur, they are written in)44 W
7200 62531 MT
(PDP-11 byte order \050low order byte first\051.)SH
8200 64738 MT
(The RLE file consists of two parts, a header followed by scanline data. The header contains)
42 W( general information)41 W
7200 65843 MT
(about the image, while the scanline data is a stream of operations describing the image itself.)SH
ES
%%Page: 1 2
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(1)SH
11 /Times-Bold AF
7200 7937 MT
(2.1. The Header)SH
1 SS
25200 7200 34242 PB md begin
T 32 760 100 72 72 psu
(rle_hdr; user: )jn
%%Title: rle_hdr
%%Creator: MAC LaserWriter Driver
%%For:
1320 od
%%EndProlog
%%Page: ? 1
op
0 0 xl
1 1 pen
0 0 gm
0 0 720 540 6 dorect
64 grlevel
495 144 712 325 4 dorect
0 grlevel
495.5 144.5 711.5 324.5 0 dorect
144 513 gm
324 513 lin
200 505 gm
0 1 6 [tb
{0 fs}fx
{12 fz}fx
%%Changefont: |----1Times
F /|----1Times fnt
68 am
(Magic number)aa
]es
223 525 gm
0 1 6 [tb
gf
23 am
(xpos)aa
]es
223 543 gm
0 1 6 [tb
gf
23 am
(ypos)aa
]es
222 561 gm
0 1 6 [tb
gf
24 am
(xsize)aa
]es
222 579 gm
0 1 6 [tb
gf
24 am
(ysize)aa
]es
178 597 gm
0 1 6 [tb
gf
23 am
(flags)aa
]es
234 585 gm
234 603 lin
144 531 gm
324 531 lin
144 549 gm
324 549 lin
144 567 gm
324 567 lin
144 585 gm
324 585 lin
144 603 gm
324 603 lin
144 621 gm
324 621 lin
144 639 gm
324 639 lin
144 657 gm
324 657 lin
144 675 gm
324 675 lin
262 597 gm
0 1 6 [tb
gf
35 am
(ncolors)aa
]es
234 603 gm
234 621 lin
165 615 gm
0 1 6 [tb
gf
48 am
(pixelbytes)aa
]es
264 615 gm
0 1 6 [tb
gf
31 am
(ncmap)aa
]es
170 633 gm
0 1 6 [tb
gf
39 am
(cmaplen)aa
]es
234 621 gm
234 657 lin
264 633 gm
0 1 6 [tb
gf
30 am
(red bg)aa
]es
169 651 gm
0 1 6 [tb
gf
41 am
(green bg)aa
]es
262 651 gm
0 1 6 [tb
gf
35 am
(blue bg)aa
]es
193 669 gm
0 1 6 [tb
gf
83 am
(color map entry 0)aa
]es
193 687 gm
0 1 6 [tb
gf
83 am
(color map entry 1)aa
]es
144 693 gm
324 693 lin
228 705 gm
1 1 6 [tb
{1 fs}fx
{12 fz}fx
%%Changefont: |----1Times
F /|----1Times sbs
fnt
13 am
(É)aa
]es
0 page
cp
%%Page: ? 2
op
-1 page
cp
%%Trailer
end
PE 10 SS
24657 36728 MT
(Figure 2-1:)SH
/Times-Roman SF
30156 XM
(RLE file header)SH
8200 38519 MT
(The header has a fixed part and a variable part. A diagram of the header)
111 W( is shown in Figure 2-1. The magic)112 W
7200 39624 MT
(number identifies the file)
79 W( as an RLE file. Following this are the coordinates of the lower left corner of the image)78 W
7200 40729 MT
(and the size of the image in the X and Y directions. Images are defined)
15 W( in a first quadrant coordinate system \050origin)16 W
7200 41834 MT
(at the lower left, X increasing to the right, Y increasing up.\051 Thus, the image is enclosed in the rectangle)SH
9200 43354 MT
([)SH
/Times-Italic SF
(xpos)SH
/Times-Roman SF
(,)SH
/Times-Italic SF
(xpos)SH
/Times-Roman SF
(+)SH
/Times-Italic SF
(xsize)SH
/Symbol SF
(-)SH
/Times-Roman SF
(1])SH
/Times-Italic SF
(X)SH
/Times-Roman SF
([)SH
/Times-Italic SF
(ypos)SH
/Times-Roman SF
(,)SH
/Times-Italic SF
(ypos)SH
/Times-Roman SF
(+)SH
/Times-Italic SF
(ysize)SH
/Symbol SF
(-)SH
/Times-Roman SF
(1].)SH
7200 44874 MT
(The position and size are 16 bit integer quantities; images up to 32K square may be saved \050the sizes)
61 W( should not be)60 W
7200 45979 MT
(negative\051.)SH
8200 48186 MT
(A flags byte follows. There are currently four flags defined:)SH
9000 49977 MT
(ClearFirst)SH
18000 XM
(If this flag is set, the image rectangle should first be cleared to the background color)156 W
18000 51082 MT
(\050q.v.\051 before reading the scanline data.)SH
9000 52659 MT
(NoBackground)SH
18000 XM
(If this flag)
177 W( is set, no background color is supplied, and the ClearFirst flag should be)176 W
18000 53764 MT
(ignored.)SH
9000 55341 MT
(Alpha)SH
18000 XM
(This flag indicates the presence of an "alpha" channel. The alpha channel is)
146 W( used by)147 W
18000 56446 MT
(image compositing software to)
44 W( correctly blend anti-aliased edges. It is stored as channel)43 W
18000 57551 MT
(-1 \050255\051.)SH
9000 59128 MT
(Comments)SH
18000 XM
(If this flag is set, comments are present in the variable part of the header, immediately)106 W
18000 60233 MT
(following the color map.)SH
8200 61338 MT
(The next)
15 W( byte is treated as an unsigned 8 bit value, and indicates the number of color channels that were saved. It)14 W
7200 62443 MT
(may have any value from 0 to 254 \050channel 255 is reserved for alpha values\051.)SH
8200 64650 MT
(The)SH
/Times-Italic SF
10027 XM
(pixelbits)SH
/Times-Roman SF
13688 XM
(byte gives the number of bits in each pixel.)
22 W( The)
296 W( only value currently supported by the software is 8)23 W
7200 65755 MT
(\050in fact, this byte is currently ignored when reading RLE files\051. Pixel sizes taking more)
3 W( than one byte will be packed)2 W
7200 66860 MT
(low order byte first.)SH
8200 69067 MT
(The next two bytes describe the size)
60 W( and shape of the color map.)61 W
/Times-Italic SF
35348 XM
(Ncmap)SH
/Times-Roman SF
38492 XM
(is the number of color channels in the)61 W
7200 70172 MT
(color map. It need not be identical)
51 W( to)50 W
/Times-Italic SF
22877 XM
(ncolors)SH
/Times-Roman SF
(, but interpretation of values of)50 W
/Times-Italic SF
38814 XM
(ncmap)SH
/Times-Roman SF
41780 XM
(different from)50 W
/Times-Italic SF
47767 XM
(0)SH
/Times-Roman SF
(,)SH
/Times-Italic SF
48817 XM
(1)SH
/Times-Roman SF
(, or)50 W
/Times-Italic SF
51000 XM
(ncolors)SH
/Times-Roman SF
7200 71277 MT
(may be ambiguous, unless)51 W
/Times-Italic SF
18209 XM
(ncolors)SH
/Times-Roman SF
21510 XM
(is)SH
/Times-Italic SF
22478 XM
(1)SH
/Times-Roman SF
(. If)352 W
/Times-Italic SF
24797 XM
(ncmap)SH
/Times-Roman SF
27764 XM
(is zero, no color map is saved.)51 W
/Times-Italic SF
40781 XM
(Cmaplen)SH
/Times-Roman SF
44693 XM
(is the log base 2)
51 W( of the)52 W
ES
%%Page: 2 3
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(2)SH
7200 7886 MT
(length of each channel of the color)
42 W( map. Thus, a value for)41 W
/Times-Italic SF
31372 XM
(cmaplen)SH
/Times-Roman SF
35051 XM
(of 8 indicates a color map with 256 entries per)41 W
7200 8991 MT
(channel.)SH
8200 11198 MT
(Immediately following the fixed header is the variable part)
23 W( of the file header. It starts with the background color.)24 W
7200 12303 MT
(The background color has)11 W
/Times-Italic SF
17907 XM
(ncolors)SH
/Times-Roman SF
21167 XM
(entries; if necessary, it is filled out to an odd number of bytes with a filler byte on)10 W
7200 13408 MT
(the end \050since the fixed header is an odd number bytes long, this returns to a 16 bit boundary\051.)SH
8200 15615 MT
(Following the background color is the color map, if present. Color map values are stored as)
22 W( 16 bit quantities, left)23 W
7200 16720 MT
(justified in the)
37 W( word. Software interpreting the color map must apply a shift appropriate to the application or to the)36 W
7200 17825 MT
(hardware being used. This convention)
45 W( permits use of the color map without knowing the original output precision.)46 W
7200 18930 MT
(The channels of the map are stored in increasing numerical order)
49 W( \050starting with channel 0\051, with the entries of each)48 W
7200 20035 MT
(channel stored also in increasing order \050starting with entry 0\051. The color map entries)
98 W( for each channel are stored)99 W
7200 21140 MT
(contiguously.)SH
8200 23347 MT
(Comments, if present, follow the color map. A 16 bit quantity giving)
104 W( the length of the comment block comes)103 W
7200 24452 MT
(first. If)
344 W( the length is odd, a filler)
47 W( byte will be present at the end, restoring the 16 bit alignment \050but this byte is not)48 W
7200 25557 MT
(part of the comments\051. The comment block contains)
36 W( any number of null-terminated text strings. These strings will)35 W
7200 26662 MT
(conventionally be of the form "name=value", allowing for easy)
42 W( retrieval of specific information. However, there is)43 W
7200 27767 MT
(no restriction that a given name appear only once, and a comment may contain an arbitrary string. The intent of)
24 W( the)23 W
7200 28872 MT
(comment block is to allow information)
120 W( to be attached to the file that is not specifically provided for in the RLE)121 W
7200 29977 MT
(format.)SH
11 /Times-Bold AF
7200 33594 MT
(2.2. The Scanline Data)SH
10 /Times-Roman AF
8200 34699 MT
(The scanline)
24 W( data consists of a sequence of operations, such as)23 W
/Times-Italic SF
33726 XM
(Run)SH
/Times-Roman SF
(,)SH
/Times-Italic SF
35860 XM
(SetChannel)SH
/Times-Roman SF
(, and)23 W
/Times-Italic SF
42711 XM
(Pixels)SH
/Times-Roman SF
(, describing the actual)23 W
7200 35804 MT
(image. An)
364 W( image is stored starting at the lower left corner and proceeding upwards)
57 W( in order of increasing scanline)58 W
7200 36909 MT
(number. Each)
342 W( operation and its associated data takes up an even number of bytes, so that all operations begin on a)45 W
7200 38014 MT
(16 bit boundary. This makes the implementation more efficient on many architectures.)SH
1 SS
14400 7200 53519 PB md begin
T 32 760 100 72 72 psu
(rleops; user: )jn
%%Title: rleops
%%Creator: MAC LaserWriter Driver
%%For:
1320 od
%%EndProlog
%%Page: ? 1
op
0 0 xl
2 2 pen
0 0 gm
0 0 720 540 6 dorect
64 grlevel
593 134 631 280 4 dorect
0 grlevel
594. 135. 630. 279. 0 dorect
206 593 gm
206 629 lin
1 1 pen
164 615 gm
0 1 7 [tb
{0 fs}fx
{12 fz}fx
%%Changefont: |----1Times
F /|----1Times fnt
38 am
(op-code)aa
]es
227 615 gm
0 1 7 [tb
gf
38 am
(operand)aa
]es
153 594 gm
153 630 lin
138 615 gm
0 1 7 [tb
gf
12 am
(00)aa
]es
2 2 pen
0 0 gm
64 grlevel
665 134 703 424 4 dorect
0 grlevel
666. 135. 702. 423. 0 dorect
206 665 gm
206 701 lin
278 665 gm
278 701 lin
350 665 gm
350 701 lin
1 1 pen
161 687 gm
0 1 6 [tb
gf
38 am
(op-code)aa
]es
232 687 gm
0 1 6 [tb
gf
22 am
(filler)aa
]es
296 681 gm
0 1 6 [tb
gf
38 am
(operand)aa
]es
295 693 gm
0 1 6 [tb
gf
41 am
(low byte)aa
]es
368 681 gm
0 1 6 [tb
gf
38 am
(operand)aa
]es
365 693 gm
0 1 6 [tb
gf
44 am
(high byte)aa
]es
153 666 gm
153 702 lin
138 687 gm
0 1 6 [tb
gf
12 am
(01)aa
]es
57 615 gm
0 1 7 [tb
gf
69 am
(Short Operand)aa
]es
58 687 gm
0 1 7 [tb
gf
68 am
(Long Operand)aa
]es
156 651 gm
0 1 6 [tb
gf
31 am
(Byte 0)aa
]es
228 651 gm
0 1 6 [tb
gf
31 am
(Byte 1)aa
]es
300 651 gm
0 1 6 [tb
gf
31 am
(Byte 2)aa
]es
372 651 gm
0 1 6 [tb
gf
31 am
(Byte 3)aa
]es
0 page
cp
%%Page: ? 2
op
-1 page
cp
%%Trailer
end
PE 10 /Times-Bold AF
22726 56005 MT
(Figure 2-2:)SH
/Times-Roman SF
28225 XM
(RLE file operand formats)SH
8200 58212 MT
(Each operation is identified)
49 W( by an 8 bit opcode, and may have one or more operands. Single operand operations)50 W
7200 59317 MT
(fit into a single 16 bit word if the operand value is less than 256. So)
17 W( that operand values are not limited to the range)16 W
7200 60422 MT
(0..255, each operation has a)32 W
/Times-Italic SF
18746 XM
(long)SH
/Times-Roman SF
20806 XM
(variant, in which the byte following the opcode is ignored)
32 W( and the following word)33 W
7200 61527 MT
(is taken as a 16 bit quantity. The long variant of an opcode is indicated by setting the bit)
58 W( 0x40 in the opcode \050this)57 W
7200 62632 MT
(allows for 64 opcodes,)
39 W( of which 6 have been used so far.\051 The two single operand formats are shown pictorially in)40 W
7200 63737 MT
(Figure 2-2.)SH
8200 65944 MT
(The individual operations will now be discussed in detail.)
90 W( The)
429 W( descriptions are phrased in terms of the actions)89 W
7200 67049 MT
(necessary to interpret the file. Three indices)
46 W( are necessary: the)47 W
/Times-Italic SF
33091 XM
(current channel)47 W
/Times-Roman SF
(, the)47 W
/Times-Italic SF
41564 XM
(scanline number)47 W
/Times-Roman SF
(, and the)47 W
/Times-Italic SF
52056 XM
(pixel)SH
7200 68154 MT
(index)SH
/Times-Roman SF
(. The)570 W
/Times-Italic SF
12401 XM
(current channel)160 W
/Times-Roman SF
19331 XM
(is the channel to which data operations apply. The)160 W
/Times-Italic SF
41511 XM
(scanline number)159 W
/Times-Roman SF
48717 XM
(is just the Y)159 W
7200 69259 MT
(position of the scanline in the image. The)165 W
/Times-Italic SF
25739 XM
(pixel index)165 W
/Times-Roman SF
30679 XM
(is the X position of)
165 W( the pixel within the scanline. The)166 W
7200 70364 MT
(operations are:)SH
ES
%%Page: 3 4
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(3)SH
9000 7886 MT
(SkipLines)SH
18000 XM
(Increment the)212 W
/Times-Italic SF
24200 XM
(scanline number)211 W
/Times-Roman SF
31510 XM
(by the operand value. This operation terminates the)211 W
18000 8991 MT
(current scanline. The)SH
/Times-Italic SF
26914 XM
(pixel index)SH
/Times-Roman SF
31524 XM
(should be reset to the xpos value from the header.)SH
9000 10568 MT
(SetColor)SH
18000 XM
(Set the)215 W
/Times-Italic SF
21430 XM
(current channel)215 W
/Times-Roman SF
28470 XM
(to the operand value. This operation does not have)
215 W( a long)216 W
18000 11673 MT
(variant. Note)
530 W( that an operand value of 255 will be interpreted)
140 W( as a)139 W
/Symbol SF
46701 XM
(-)SH
/Times-Roman SF
(1, indicating the)139 W
18000 12778 MT
(alpha channel. All other operand values)
21 W( are positive. The)22 W
/Times-Italic SF
41814 XM
(pixel index)22 W
/Times-Roman SF
46468 XM
(is reset to the xpos)22 W
18000 13883 MT
(value.)SH
9000 15460 MT
(SkipPixels)SH
18000 XM
(Skip over pixels in the)
152 W( current scanline. Increment)151 W
/Times-Italic SF
40026 XM
(pixel index)151 W
/Times-Roman SF
44938 XM
(by the operand value.)151 W
18000 16565 MT
(Pixels skipped will be left in the background color.)SH
9000 18142 MT
(PixelData)SH
18000 XM
(Following this opcode is)
29 W( a sequence of pixel values. The length of the sequence is given)30 W
18000 19247 MT
(by the operand value. If the length of)
148 W( the sequence is odd, a filler byte is appended.)147 W
18000 20352 MT
(Pixel values are inserted into the scanline in increasing X order. The)193 W
/Times-Italic SF
48337 XM
(pixel index)193 W
/Times-Roman SF
53333 XM
(is)SH
18000 21457 MT
(incremented by the sequence length.)SH
9000 23034 MT
(Run)SH
18000 XM
(This is the only two operand opcode. The first operand is the length \050)34 W
/Times-Italic SF
(N)SH
/Times-Roman SF
(\051 of the run.)
34 W( The)316 W
8 SS
47918 23802 MT
(1)SH
10 SS
18000 24147 MT
(second operand is the pixel value, followed by a filler byte if necessary)121 W
48318 XM
(. The)
494 W( next)122 W
/Times-Italic SF
53333 XM
(N)SH
/Times-Roman SF
18000 25252 MT
(pixels in the scanline are set to)
50 W( the given pixel value. The)49 W
/Times-Italic SF
42084 XM
(pixel index)49 W
/Times-Roman SF
46792 XM
(is incremented by)49 W
/Times-Italic SF
18000 26357 MT
(N)SH
/Times-Roman SF
(, to point to the pixel following the run.)SH
9000 27934 MT
(EOF)SH
18000 XM
(This opcode has no operand, and indicates the end of the RLE file. It)
34 W( is provided so that)35 W
18000 29039 MT
(RLE files may be concatenated together and still be correctly)
225 W( interpreted. It is not)224 W
18000 30144 MT
(required, a physical end of file will also indicate the end of the RLE data.)SH
11 /Times-Bold AF
7200 33761 MT
(2.3. Subroutine Interface)SH
10 /Times-Roman AF
8200 34866 MT
(Two similar subroutine interfaces are provided for)
126 W( reading and writing files in the RLE format. Both read or)127 W
7200 35971 MT
(write a)
39 W( scanline worth of data at a time. A simple "row" interface communicates in terms of arrays of pixel values.)38 W
7200 37076 MT
(It is simple)
80 W( to use, but slower than the "raw" interface, which uses a list of "opcode" values as its communication)81 W
7200 38181 MT
(medium.)SH
8200 40388 MT
(In both cases,)
194 W( the interface must be initialized by calling a setup function. The two types of calls may be)193 W
7200 41493 MT
(interleaved; for example, in a rendering program, the background could)
60 W( be written using the "raw" interface, while)61 W
7200 42598 MT
(scanlines containing image data could be)
120 W( converted with the "row" interface. The package allows multiple RLE)119 W
7200 43703 MT
(streams to be open simultaneously, as is necessary for use in)
22 W( a compositing tool, for example. All data relevant to a)23 W
7200 44808 MT
(particular RLE stream is contained in a "globals" structure.)SH
8200 47015 MT
(The globals structure echoes the format of the RLE header. The fields are described below:)SH
9000 48806 MT
(dispatch)SH
18000 XM
(The RLE creation)
29 W( routines are capable of writing various types of output files in addition)28 W
18000 49911 MT
(to RLE. This value is an index into a)
230 W( dispatch table. This value is initialized by)231 W
/Times-Italic SF
18000 51016 MT
(sv_setup)SH
/Times-Roman SF
(.)SH
9000 52593 MT
(ncolors)SH
18000 XM
(The number of color channels in the output file.)
53 W( Up)
355 W( to this many color channels will be)52 W
18000 53698 MT
(saved, depending on the values in the channel bitmap \050see below\051.)SH
9000 55275 MT
(bg_color)SH
18000 XM
(A pointer to an array of)SH
/Times-Italic SF
27664 XM
(ncolors)SH
/Times-Roman SF
30914 XM
(integers containing the background color.)SH
9000 56852 MT
(alpha)SH
18000 XM
(If this is non-zero, an alpha channel will be)
54 W( saved. The presence or absence of an alpha)55 W
18000 57957 MT
(channel has no effect on the value in)SH
/Times-Italic SF
32885 XM
(ncolors)SH
/Times-Roman SF
(.)SH
9000 59534 MT
(background)SH
18000 XM
(Indicates how to treat background pixels. It has the following values:)SH
18000 61325 MT
(0)SH
21600 XM
(Save all pixels, the background color is ignored.)SH
18000 62902 MT
(1)SH
21600 XM
(Save only non-background)
198 W( pixels, but don't set the "clear screen" bit. This)197 W
21600 64007 MT
(indicates "overlay" mode, a cheap form of compositing \050but see note)
205 W( below)206 W
21600 65112 MT
(about this.\051)SH
18000 66689 MT
(2)SH
21600 XM
(Save only non-background pixels, clear the screen to the background color)249 W
21600 67794 MT
(before restoring the image.)SH
10800 50 7200 70352 UL
6 SS
8000 71691 MT
(1)SH
8 SS
8300 72000 MT
(E.g., a 16 bit pixel value would not need a filler byte.)SH
ES
%%Page: 4 5
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(4)SH
9000 7886 MT
(xmin, xmax, ymin, ymax)SH
18000 8991 MT
(Inclusive bounds of the image region being saved.)SH
9000 10568 MT
(ncmap)SH
18000 XM
(Number of channels of color map to be)
36 W( saved. The color map will not be saved if this is)35 W
18000 11673 MT
(0.)SH
9000 13250 MT
(cmaplen)SH
18000 XM
(Log base 2 of the number of entries in each channel of the color map.)SH
9000 14827 MT
(cmap)SH
18000 XM
(Pointer to an array containing the color map. The map)
15 W( is saved in "channel major" order.)16 W
18000 15932 MT
(Each entry in the map is a 16 bit)
55 W( value with the color value left justified in the word. If)54 W
18000 17037 MT
(this pointer is NULL, no color map will be saved.)SH
9000 18614 MT
(comments)SH
18000 XM
(Pointer to an array of pointers to strings. The array is)
SH( terminated by a NULL pointer \050like)1 W
/Times-Italic SF
18000 19719 MT
(argv)SH
/Times-Roman SF
20284 XM
(or)SH
/Times-Italic SF
21568 XM
(envp)SH
/Times-Roman SF
(\051. If)
652 W( this pointer is NULL or if the first pointer it)
201 W( points to is NULL,)200 W
18000 20824 MT
(comments will not be saved.)SH
9000 22401 MT
(fd)SH
18000 XM
(File \050FILE *\051 pointer to be used for writing or reading the RLE file.)SH
9000 23978 MT
(bits)SH
18000 XM
(A bitmap containing 256 bits.)
270 W( A)
791 W( channel will be saved \050or retrieved\051 only if the)271 W
18000 25083 MT
(corresponding bit is set in the bitmap. The alpha channel corresponds to bit 255.)
101 W( The)451 W
18000 26188 MT
(bitmap allows an application to easily ignore color channel data that is irrelevant to it.)SH
8200 27293 MT
(The globals structure also contains private)
11 W( data for use by the RLE reading and writing routines; data that must be)12 W
7200 28398 MT
(maintained between calls, but that applies to each stream separately.)SH
11 /Times-Bold AF
7200 32015 MT
(2.4. Writing RLE files)SH
10 /Times-Roman AF
8200 33120 MT
(To create a run-length encoded file, one first)
22 W( initializes a globals structure with the relevant information about the)21 W
7200 34225 MT
(image, including the output file descriptor. The output file should be open and empty. Then one calls)SH
/Times-Italic SF
48307 XM
(sv_setup)SH
/Times-Roman SF
(:)SH
/Courier-Bold SF
9600 35751 MT
(sv_setup\050 RUN_DISPATCH, &globals \051;)SH
/Times-Roman SF
7200 37289 MT
(This writes the file header and initializes the private portions of the global data structure for)
104 W( use by the RLE file)105 W
7200 38394 MT
(writing routines.)SH
8200 40601 MT
(The image data must)
51 W( be available or expressible in a scanline order \050with the origin at the bottom of the screen\051.)50 W
7200 41706 MT
(After each scanline is computed,)
142 W( it is written to the output file by calling one of)143 W
/Times-Italic SF
41508 XM
(sv_putrow)SH
/Times-Roman SF
46068 XM
(or)SH
/Times-Italic SF
47294 XM
(sv_putraw)SH
/Times-Roman SF
(. If)
536 W( a)143 W
7200 42811 MT
(vertical interval of the image has no data, it may be skipped by calling sv_skiprow:)SH
/Courier-Bold SF
9600 44337 MT
(/* Skip nrow scanlines */)SH
9600 45468 MT
(sv_skiprow\050 &globals, nrow \051;)SH
/Times-Roman SF
8200 47675 MT
(If the image data for a scanline is)
16 W( available as an array of pixel values,)15 W
/Times-Italic SF
36813 XM
(sv_putrow)SH
/Times-Roman SF
41245 XM
(should be used to write the data)15 W
7200 48780 MT
(to the output file. As an example, let us assume that we have a 512 pixel long)
68 W( scanline, with three color channels)69 W
7200 49885 MT
(and no alpha data. We could call)SH
/Times-Italic SF
20780 XM
(sv_putrow)SH
/Times-Roman SF
25197 XM
(as follows:)SH
/Courier-Bold SF
9600 51411 MT
(rle_pixel scandata[3][512], *rows[3];)SH
9600 52542 MT
(int i;)SH
9600 54804 MT
(for \050 i = 0; i < 3; i++ \051)SH
12000 55935 MT
(rows[i] = scandata[i];)SH
9600 57066 MT
(sv_putrow\050 rows, 512, &globals \051;)SH
/Times-Roman SF
7200 58604 MT
(Note that)38 W
/Times-Italic SF
11219 XM
(sv_putrow)SH
/Times-Roman SF
15673 XM
(is passed an array of pointers to vectors of pixels. This makes it easy to pass arbitrarily many,)37 W
7200 59709 MT
(and to specify values of)SH
/Times-Italic SF
16948 XM
(rowlen)SH
/Times-Roman SF
19976 XM
(different from the size of \050e.g.\051 the)SH
/Times-Italic SF
34055 XM
(scandata)SH
/Times-Roman SF
37916 XM
(array.)SH
8200 61916 MT
(The first element of each row of pixels is the pixel at the)61 W
/Times-Italic SF
31850 XM
(xmin)SH
/Times-Roman SF
34105 XM
(location in the scanline. Therefore, when saving)61 W
7200 63021 MT
(only part of an image, one must be careful to set the)SH
/Times-Italic SF
28224 XM
(rows)SH
/Times-Roman SF
30419 XM
(pointers to point to the correct pixel in the scanline.)SH
8200 65228 MT
(If an alpha channel is specified to be saved, things)
31 W( get a little more complex. Here is the same example, but now)30 W
7200 66333 MT
(with an alpha channel being saved.)SH
ES
%%Page: 5 6
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(5)SH
/Courier-Bold SF
9600 7874 MT
(rle_pixel scandata[3][512],)SH
15600 9005 MT
(alpha[512], *rows[4];)SH
9600 10136 MT
(int i;)SH
9600 12398 MT
(rows[0] = alpha;)SH
9600 13529 MT
(for \050 i = 0; i < 3; i++ \051)SH
12000 14660 MT
(rows[i+1] = scandata[i];)SH
9600 15791 MT
(sv_putrow\050 rows+1, 512, &globals \051;)SH
/Times-Roman SF
7200 17329 MT
(The)SH
/Times-Italic SF
9011 XM
(sv_putrow)SH
/Times-Roman SF
13434 XM
(routine expects to find the pointer to)
6 W( the alpha channel at the)7 W
/Symbol SF
38008 XM
(-)SH
/Times-Roman SF
(1 position in the rows array. Thus, we)7 W
7200 18434 MT
(pass a pointer to)SH
/Times-Italic SF
13977 XM
(rows[1])SH
/Times-Roman SF
17450 XM
(and put the pointer to the alpha channel in)SH
/Times-Italic SF
34531 XM
(rows[0])SH
/Times-Roman SF
(.)SH
8200 20641 MT
(Finally, after all scanlines have been written, we)
47 W( call)46 W
/Times-Italic SF
29922 XM
(sv_puteof)SH
/Times-Roman SF
34051 XM
(to write an)46 W
/Times-Italic SF
38716 XM
(EOF)SH
/Times-Roman SF
40956 XM
(opcode into the file. This is not)46 W
7200 21746 MT
(strictly necessary, since a physical end of file also indicates the end of the RLE data, but it is a good idea.)SH
8200 23953 MT
(Here is a skeleton)
56 W( of an application that uses)57 W
/Times-Italic SF
26790 XM
(sv_putrow)SH
/Times-Roman SF
31264 XM
(to save an image is shown in Figure 2-3. This example)57 W
7200 25058 MT
(uses the)
38 W( default values supplied in the globals variable)37 W
/Times-Italic SF
29559 XM
(sv_globals)SH
/Times-Roman SF
(, modifying it to indicate the presence of an alpha)37 W
7200 26163 MT
(channel.)SH
8200 28370 MT
(Using)SH
/Times-Italic SF
10898 XM
(sv_putraw)SH
/Times-Roman SF
15374 XM
(is more complicated, as it)
59 W( takes arrays of)60 W
/Times-Italic SF
32430 XM
(rle_op)SH
/Times-Roman SF
35351 XM
(structures instead of just pixels. If the data is)60 W
7200 29475 MT
(already available in something close to this form, however,)42 W
/Times-Italic SF
31491 XM
(sv_putraw)SH
/Times-Roman SF
35949 XM
(will run much more quickly than)41 W
/Times-Italic SF
49583 XM
(sv_putrow)SH
/Times-Roman SF
(.)SH
7200 30580 MT
(An)SH
/Times-Italic SF
8672 XM
(rle_op)SH
/Times-Roman SF
11533 XM
(is a structure with the following contents:)SH
9000 32371 MT
(opcode)SH
18000 XM
(The type of data. One of)SH
/Times-Italic SF
28275 XM
(ByteData)SH
/Times-Roman SF
32302 XM
(or)SH
/Times-Italic SF
33385 XM
(RunData)SH
/Times-Roman SF
(.)SH
9000 33948 MT
(xloc)SH
18000 XM
(The X location within the scanline at which this data begins.)SH
9000 35525 MT
(length)SH
18000 XM
(The length of the data. This is either the number of pixels)
57 W( that are the same color, for a)58 W
18000 36630 MT
(run, or the number of pixels provided as byte data.)SH
9000 38207 MT
(pixels)SH
18000 XM
(A pointer to an array of pixel values. This field is used only for the)SH
/Times-Italic SF
45246 XM
(ByteData)SH
/Times-Roman SF
49273 XM
(opcode.)SH
9000 39784 MT
(run_val)SH
18000 XM
(The pixel value for a)SH
/Times-Italic SF
26581 XM
(RunData)SH
/Times-Roman SF
30442 XM
(opcode.)SH
8200 40889 MT
(Since there is no guarantee that the different color channels will require the same set of)53 W
/Times-Italic SF
44151 XM
(rle_ops)SH
/Times-Roman SF
47453 XM
(to describe their)52 W
7200 41994 MT
(data, a separate count must be provided for each channel. Here is a sample call to)SH
/Times-Italic SF
40219 XM
(sv_putraw)SH
/Times-Roman SF
(:)SH
/Courier-Bold SF
9600 43520 MT
(int nraw[3];)
SH( /*)
1800 W( Length of each row */)SH
9600 44651 MT
(rle_op *rows[3];/* Data pointers */)SH
9600 45782 MT
(sv_putraw\050 rows, nraw, &globals \051;)SH
/Times-Roman SF
7200 47320 MT
(A more)
70 W( complete example of the use of)71 W
/Times-Italic SF
23819 XM
(sv_putraw)SH
/Times-Roman SF
28307 XM
(will be given in connection with the description of)71 W
/Times-Italic SF
49361 XM
(rle_getraw)SH
/Times-Roman SF
(,)SH
7200 48425 MT
(below.)SH
8200 50632 MT
(Calls to)SH
/Times-Italic SF
11534 XM
(sv_putrow)SH
/Times-Roman SF
15951 XM
(and)SH
/Times-Italic SF
17645 XM
(sv_putraw)SH
/Times-Roman SF
22062 XM
(may be freely intermixed, as required by the application.)SH
11 /Times-Bold AF
7200 54249 MT
(2.5. Reading RLE Files)SH
10 /Times-Roman AF
8200 55354 MT
(Reading an RLE file is much like writing one. An initial call to a setup routine reads)
57 W( the file header and fills in)56 W
7200 56459 MT
(the)SH
/Times-Italic SF
8672 XM
(globals)SH
/Times-Roman SF
11867 XM
(structure. Then,)
250 W( a scanline at a time is read by calling)SH
/Times-Italic SF
33696 XM
(rle_getrow)SH
/Times-Roman SF
38335 XM
(or)SH
/Times-Italic SF
39418 XM
(rle_getraw)SH
/Times-Roman SF
(.)SH
8200 58666 MT
(The calling program is responsible for opening the input file. A call to)86 W
/Times-Italic SF
37985 XM
(rle_get_setup)SH
/Times-Roman SF
43766 XM
(will then read the header)87 W
7200 59771 MT
(information and fill in the supplied globals structure. The return code from)139 W
/Times-Italic SF
39392 XM
(rle_get_setup)SH
/Times-Roman SF
45225 XM
(indicates a variety)
139 W( of)138 W
7200 60876 MT
(errors, such as the input file not being an RLE file, or encountering an EOF while reading the header.)SH
8200 63083 MT
(Each time)36 W
/Times-Italic SF
12549 XM
(rle_getrow)SH
/Times-Roman SF
17224 XM
(is called, it fills in the)
36 W( supplied scanline buffer with one scanline of image data and returns)37 W
7200 64188 MT
(the Y position of the scanline \050which will be one greater than the previous time it was)
81 W( called\051. Depending on the)80 W
7200 65293 MT
(setting of the)43 W
/Times-Italic SF
12801 XM
(background)SH
/Times-Roman SF
17871 XM
(flag, the scanline buffer may or may not be cleared to)
43 W( the background color on each call.)44 W
7200 66398 MT
(If it)
84 W( is not \050)83 W
/Times-Italic SF
(background)SH
/Times-Roman SF
17143 XM
(is 0 or 1\051, and if the caller does not clear the buffer between scanlines, then a "smearing")83 W
7200 67503 MT
(effect will be seen, if some pixels from previous scanlines are not overwritten by pixels on)
125 W( the current scanline.)126 W
7200 68608 MT
(Note that if)141 W
/Times-Italic SF
12428 XM
(background)SH
/Times-Roman SF
17596 XM
(is 0, then no background color was supplied, and setting)140 W
/Times-Italic SF
41716 XM
(background)SH
/Times-Roman SF
46883 XM
(to 2 to try to get)140 W
7200 69713 MT
(automatic buffer clearing will usually cause a segmentation fault when)40 W
/Times-Italic SF
36150 XM
(rle_getrow)SH
/Times-Roman SF
40829 XM
(tries to get the background)
40 W( color)41 W
7200 70818 MT
(through the)SH
/Times-Italic SF
12033 XM
(bg_color)SH
/Times-Roman SF
15894 XM
(pointer.)SH
ES
%%Page: 6 7
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(6)SH
/Courier-Bold SF
9600 7874 MT
(#include <svfb_global.h>)SH
9600 10136 MT
(main\050\051)SH
9600 11267 MT
({)SH
14400 12398 MT
(rle_pixel scanline[3][512], alpha[512], *rows[4];)SH
14400 13529 MT
(int y, i;)SH
14400 15791 MT
(/* Most of the default values in sv_globals are ok */)SH
14400 16922 MT
(/* We do have an alpha channel, though */)SH
14400 18053 MT
(sv_globals.sv_alpha = 1;)SH
14400 19184 MT
(SV_SET_BIT\050 sv_globals, SV_ALPHA \051;)SH
14400 21446 MT
(rows[0] = alpha;)SH
14400 22577 MT
(for \050 i = 0; i < 3; i++ \051)SH
19200 23708 MT
(rows[i+1] = scanline[i];)SH
14400 25970 MT
(sv_setup\050 RUN_DISPATCH, &sv_globals \051;)SH
14400 28232 MT
(/* Create output for 512 x 480 \050default size\051 display */)SH
14400 29363 MT
(for \050 y = 0; y < 480; y++ \051)SH
14400 30494 MT
({)SH
19200 31625 MT
(mk_scanline\050 y, scanline, alpha \051;)SH
19200 32756 MT
(sv_putrow\050 rows, 512, &sv_globals \051;)SH
14400 33887 MT
(})SH
14400 35018 MT
(sv_puteof\050 &sv_globals \051;)SH
9600 36149 MT
(})SH
/Times-Bold SF
21962 37759 MT
(Figure 2-3:)SH
/Times-Roman SF
27461 XM
(Example of use of sv_putrow)SH
8200 39966 MT
(Figure 2-4 shows an)
92 W( example of the use of)91 W
/Times-Italic SF
26269 XM
(rle_getrow)SH
/Times-Roman SF
(. Note)
432 W( the dynamic allocation of scanline storage space,)91 W
7200 41071 MT
(and compensation for presence of an alpha channel. A subroutine,)132 W
/Times-Italic SF
35562 XM
(rle_row_alloc)SH
/Times-Roman SF
(, is available that)
132 W( performs the)133 W
7200 42176 MT
(storage allocation automatically. It is described below.)
348 W( If)
945 W( the alpha channel were irrelevant, the macro)347 W
/Times-Italic SF
7200 43281 MT
(SV_CLR_BIT)SH
/Times-Roman SF
12895 XM
(could be used to inhibit reading it, and no storage space would be needed for it.)SH
8200 45488 MT
(The function)20 W
/Times-Italic SF
13628 XM
(rle_getraw)SH
/Times-Roman SF
18287 XM
(is the inverse of)21 W
/Times-Italic SF
24981 XM
(sv_putraw)SH
/Times-Roman SF
(. When)
292 W( called, it fills in the supplied buffer with raw data for)21 W
8 SS
30129 46256 MT
(15)SH
10 SS
7200 46601 MT
(a single scanline. It returns the scanline)62 W
/Times-Italic SF
23943 XM
(y)SH
/Times-Roman SF
24699 XM
(position, or 2)62 W
31241 XM
(to indicate)
62 W( end of file. It is assumed that no image will)61 W
8 SS
14594 47369 MT
(15)SH
10 SS
7200 47714 MT
(have more)
159 W( than 2)160 W
/Symbol SF
15394 XM
(-)SH
/Times-Roman SF
(1 scanlines. A complete program \050except for error checking\051 that reads an RLE file from)160 W
7200 48819 MT
(standard input and produces a negative image on standard output is shown in Figure 2-5.)SH
8200 51026 MT
(The functions)132 W
/Times-Italic SF
14241 XM
(rle_row_alloc)SH
/Times-Roman SF
20290 XM
(and)SH
/Times-Italic SF
22116 XM
(rle_raw_alloc)SH
/Times-Roman SF
28165 XM
(simplify allocation of)
132 W( buffer space for use by the rle routines.)131 W
7200 52131 MT
(Both use a supplied globals structure to determine how many and which channels need buffer)
54 W( space, as well as the)55 W
7200 53236 MT
(size of the buffer for each scanline. The)
151 W( returned buffer pointers will be adjusted for the presence of an alpha)150 W
7200 54341 MT
(channel, if it is present. Buffer space for pixel or)39 W
/Times-Italic SF
27541 XM
(rle_op)SH
/Times-Roman SF
30441 XM
(data will be allocate only)
39 W( for those channels that have bits)40 W
7200 55446 MT
(set in the channel bitmap. The buffer space may be freed by calling)SH
/Times-Italic SF
34610 XM
(rle_row_free)SH
/Times-Roman SF
40082 XM
(or)SH
/Times-Italic SF
41165 XM
(rle_raw_free)SH
/Times-Roman SF
(, respectively.)SH
12 /Times-Bold AF
7200 59130 MT
(3. Comments, issues, and directions)SH
10 /Times-Roman AF
8200 60235 MT
(Some comments on the file format and current subroutine implementation:)SH
/Symbol SF
8990 61688 MT
(\267)SH
/Times-Roman SF
9700 XM
(The background color for the alpha channel is always 0.)SH
/Symbol SF
8990 63446 MT
(\267)SH
/Times-Roman SF
9700 XM
(All channels must have the same number of bits. This could be a problem when saving, e.g., Z values,)38 W
9700 64551 MT
(or if more than 8 bits of precision were desired for the alpha channel.)SH
/Symbol SF
8990 66309 MT
(\267)SH
/Times-Roman SF
9700 XM
(Pixels are skipped \050by)42 W
/Times-Italic SF
18978 XM
(sv_putrow)SH
/Times-Roman SF
(\051 only if all channel)
42 W( values of the pixel are equal to the corresponding)43 W
9700 67414 MT
(background color values.)SH
/Symbol SF
8990 69172 MT
(\267)SH
/Times-Roman SF
9700 XM
(The current Implementation of)49 W
/Times-Italic SF
22449 XM
(sv_putrow)SH
/Times-Roman SF
26915 XM
(skips pixels only if at least 2 adjacent pixels are equal to the)49 W
9700 70277 MT
(background. The)
250 W( SkipPixels operation is intended for efficiency, not to provide cheap compositing.)SH
ES
%%Page: 7 8
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(7)SH
/Courier-Bold SF
9600 7874 MT
(/* An example of using rle_getrow */)SH
9600 9005 MT
(/* Scanline pointer */)SH
9600 10136 MT
(rle_pixel ** scan;)SH
9600 11267 MT
(int i;)SH
9600 13529 MT
(/* Read the RLE file from stdin */)SH
9600 14660 MT
(rle_get_setup\050 &globals \051;)SH
9600 16922 MT
(/* Allocate enough space for scanline data, including alpha channel */)SH
9600 18053 MT
(/* \050Should check for non-zero return, indicating a malloc error\051 */)SH
9600 19184 MT
(rle_row_alloc\050 &globals, &scan \051;)SH
9600 21446 MT
(/* Read scanline data */)SH
9600 22577 MT
(while \050 \050y = rle_getrow\050 &globals, stdin, scan \051 <= globals.sv_ymax \051)SH
14400 23708 MT
(/* Use the scanline data */;)SH
/Times-Bold SF
22324 26449 MT
(Figure 2-4:)SH
/Times-Roman SF
27823 XM
(Example of rle_getrow use.)SH
/Symbol SF
8990 28354 MT
(\267)SH
/Times-Roman SF
9700 XM
(Nothing forces the image data to lie within the bounds declared in the header. However,)106 W
/Times-Italic SF
47111 XM
(rle_getrow)SH
/Times-Roman SF
9700 29459 MT
(will not)
256 W( write outside these bounds, to prevent core dumps. No such protection is provided by)255 W
/Times-Italic SF
9700 30564 MT
(rle_getraw)SH
/Times-Roman SF
(.)SH
/Symbol SF
8990 32322 MT
(\267)SH
/Times-Roman SF
9700 XM
(Images saved in RLE are usually about 1/3 their original size)
230 W( \050for an "average" image\051. Highly)231 W
9700 33427 MT
(complex images may end up slightly larger than they would have been if saved by the trivial method.)SH
8200 35634 MT
(We have not yet decided how pixels with)
72 W( other than 8 bits should be packed into the file. To keep the file size)71 W
7200 36739 MT
(down, one would like to pack)29 W
/Times-Italic SF
19456 XM
(ByteData)SH
/Times-Roman SF
23512 XM
(as tightly as possible. However,)
29 W( for interpretation speed, it would probably)30 W
7200 37844 MT
(be better to save one value in each \050)SH
/Times-Italic SF
(pixelbits)SH
/Times-Roman SF
(+7\051/8 bytes.)SH
8200 40051 MT
(Some proposed enhancements include:)SH
/Symbol SF
8990 41504 MT
(\267)SH
/Times-Roman SF
9700 XM
(A "ramp" opcode. This specifies that pixel values should)
49 W( be linearly ramped between two values for a)48 W
9700 42609 MT
(given number)
2 W( of pixels in the scanline. This opcode would be difficult to generate from an image, but if)3 W
9700 43714 MT
(an application knew it was generating a ramp,)
133 W( it could produce significant file size savings \050e.g. in)132 W
9700 44819 MT
(Gouraud shaded images\051.)SH
/Symbol SF
8990 46577 MT
(\267)SH
/Times-Roman SF
9700 XM
(Opcodes indicating that the current scanline)
86 W( is identical to the previous, or that it differs only slightly)87 W
9700 47682 MT
(\050presumably followed by standard opcodes)
75 W( indicating the difference\051. Detection of identical scanlines)74 W
9700 48787 MT
(is easy, deciding that a scanline differs slightly enough)
120 W( to warrant a differential description could be)121 W
8 SS
44306 49555 MT
(2)SH
10 SS
9700 49900 MT
(difficult. In)
250 W( images with large areas with little change, this could produce size savings)SH
8200 52107 MT
(The subroutine library is still missing some useful functions. Some proposed additions are:)SH
/Symbol SF
8990 53560 MT
(\267)SH
/Times-Roman SF
9700 XM
(Conversion from "raw")
27 W( to "row" format, and back. One could then view)26 W
/Times-Italic SF
39361 XM
(sv_putrow)SH
/Times-Roman SF
43804 XM
(as being a "raw" to)26 W
9700 54665 MT
("row" conversion followed by a call to)70 W
/Times-Italic SF
25920 XM
(sv_putraw)SH
/Times-Roman SF
(, and)70 W
/Times-Italic SF
32421 XM
(rle_getrow)SH
/Times-Roman SF
37131 XM
(as a call to)71 W
/Times-Italic SF
41914 XM
(rle_getraw)SH
/Times-Roman SF
46624 XM
(followed by)71 W
9700 55770 MT
("row" to "raw" conversion.)SH
/Symbol SF
8990 57528 MT
(\267)SH
/Times-Roman SF
9700 XM
(A function to merge several)
25 W( channels of "raw" data into a single channel. For example, this would take)24 W
9700 58633 MT
(separate red, green, and blue)
99 W( channels and combine them into a single RGB channel. This would be)100 W
9700 59738 MT
(useful for)
14 W( RLE interpretation on devices that do not easily support the separate channel paradigm, while)13 W
9700 60843 MT
(preserving the efficiency of the "raw" interface. It could also be)
109 W( used to increase the efficiency of a)110 W
9700 61948 MT
(compositing program.)SH
8200 64155 MT
(The Utah RLE format has developed and matured over a period of about six years, and has proven to be versatile)28 W
7200 65260 MT
(and useful for a wide)
146 W( variety of applications that require image transmittal and storage. It provides a compact,)147 W
7200 66365 MT
(efficiently interpreted image storage capability. We expect to see continued development of)
30 W( capabilities and utility,)29 W
7200 67470 MT
(but expect very little change in the basic format.)SH
10800 50 7200 70352 UL
6 SS
8000 71691 MT
(2)SH
8 SS
8300 72000 MT
(This suggestion was inspired by a description of the RLE format used at Ohio State University.)SH
ES
%%Page: 8 9
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(8)SH
/Courier-Bold SF
9600 7874 MT
(#include <stdio.h>)SH
9600 9005 MT
(#include <svfb_global.h>)SH
9600 10136 MT
(#include <rle_getraw.h>)SH
9600 12398 MT
(main\050\051)SH
9600 13529 MT
({)SH
12000 14660 MT
(struct sv_globals in_glob, out_glob;)SH
12000 15791 MT
(rle_op ** scan;)SH
12000 16922 MT
(int * nraw, i, j, c, y, newy;)SH
12000 19184 MT
(in_glob.svfb_fd = stdin;)SH
12000 20315 MT
(rle_get_setup\050 &in_glob \051;)SH
12000 21446 MT
(/* Copy setup information from input to output file */)SH
12000 22577 MT
(out_glob = in_glob;)SH
12000 23708 MT
(out_glob.svfb_fd = stdout;)SH
12000 25970 MT
(/* Get storage for calling rle_getraw */)SH
12000 27101 MT
(rle_raw_alloc\050 &in_glob, &scan, &nraw \051;)SH
12000 29363 MT
(/* Negate background color! */)SH
12000 30494 MT
(if \050 in_glob.sv_background \051)SH
14400 31625 MT
(for \050 i = 0; i < in_glob.sv_ncolors; i++ \051)SH
16800 32756 MT
(out_glob.sv_bg_color[i] = 255 - out_glob.sv_bg_color[i];)SH
12000 35018 MT
(/* Init output file */)SH
12000 36149 MT
(sv_setup\050 RUN_DISPATCH, &out_glob \051;)SH
12000 38411 MT
(y = in_glob.sv_ymin;)SH
12000 39542 MT
(while \050 \050newy = rle_getraw\050 &in_glob, scan, nraw \051\051 != 32768 \051 {)SH
14400 40673 MT
(/* If > one line skipped in input, do same in output */)SH
14400 41804 MT
(if \050 newy - y > 1 \051)SH
16800 42935 MT
(sv_skiprow\050 &out_glob, newy - y \051;)SH
14400 44066 MT
(y = newy;)SH
14400 45197 MT
(/* Map all color channels */)SH
14400 46328 MT
(for \050 c = 0; c < out_glob.sv_ncolors; c++ \051)SH
16800 47459 MT
(for \050 i = 0; i < nraw[c]; i++ \051)SH
19200 48590 MT
(switch\050 scan[c][i].opcode \051 {)SH
19200 49721 MT
(case RRunDataOp:)SH
21600 50852 MT
(scan[c][i].u.run_val = 255 - scan[c][i].u.run_val;)SH
21600 51983 MT
(break;)SH
19200 53114 MT
(case RByteDataOp:)SH
21600 54245 MT
(for \050 j = 0; j < scan[c][i].length; j++ \051)SH
24000 55376 MT
(scan[c][i].u.pixels[j] =)SH
26400 56507 MT
(255 - scan[c][i].u.pixels[j];)SH
21600 57638 MT
(break;)SH
19200 58769 MT
(})SH
14400 59900 MT
(sv_putraw\050 scan, nraw, &out_glob \051;)SH
14400 61031 MT
(/* Free raw data */)SH
14400 62162 MT
(rle_freeraw\050 &in_glob, scan, nraw \051;)SH
12000 63293 MT
(})SH
12000 64424 MT
(sv_puteof\050 &out_glob \051;)SH
12000 66686 MT
(/* Free storage */)SH
12000 67817 MT
(rle_raw_free\050 &in_glob, scan, nraw \051;)SH
9600 68948 MT
(})SH
/Times-Bold SF
19227 71689 MT
(Figure 2-5:)SH
/Times-Roman SF
24726 XM
(Program to produce a negative of an image)SH
ES
%%Page: 9 10
BS
0 SI
10 /Times-Roman AF
30350 4286 MT
(9)SH
12 /Times-Bold AF
7200 8004 MT
(4. Acknowledgments)SH
10 /Times-Roman AF
8200 9109 MT
(This work was supported)
138 W( in part by the National Science Foundation \050DCR-8203692 and DCR-8121750\051, the)139 W
7200 10214 MT
(Defense Advanced Research Projects Agency \050DAAK11-84-K-0017\051, the Army)
179 W( Research Office \050DAAG29-81-)178 W
7200 11319 MT
(K-0111\051, and the Office of Naval Research \050N00014-82-K-0351\051. All opinions,)
376 W( findings, conclusions or)377 W
7200 12424 MT
(recommendations expressed in this document are those)
24 W( of the authors and do not necessarily reflect the views of the)23 W
7200 13529 MT
(sponsoring agencies.)SH
ES
%%Page: i 11
BS
0 SI
10 /Times-Roman AF
30461 4286 MT
(i)SH
12 /Times-Bold AF
26033 8004 MT
(Table of Contents)SH
11 SS
8850 9172 MT
(1. Introduction)SH
53450 XM
(0)SH
8850 10340 MT
(2. Description of RLE Format)SH
53450 XM
(0)SH
10 SS
10700 11420 MT
(2.1. The Header)SH
53500 XM
(1)SH
10700 12500 MT
(2.2. The Scanline Data)SH
53500 XM
(2)SH
10700 13580 MT
(2.3. Subroutine Interface)SH
53500 XM
(3)SH
10700 14660 MT
(2.4. Writing RLE files)SH
53500 XM
(4)SH
10700 15740 MT
(2.5. Reading RLE Files)SH
53500 XM
(5)SH
11 SS
8850 16908 MT
(3. Comments, issues, and directions)SH
53450 XM
(6)SH
8850 18076 MT
(4. Acknowledgments)SH
53450 XM
(9)SH
ES
%%Page: ii 12
BS
0 SI
10 /Times-Roman AF
30322 4286 MT
(ii)SH
12 /Times-Bold AF
26866 8004 MT
(List of Figures)SH
11 SS
8850 9172 MT
(Figure 2-1:)
SH( RLE)
550 W( file header)SH
53450 XM
(1)SH
8850 10340 MT
(Figure 2-2:)
SH( RLE)
550 W( file operand formats)SH
53450 XM
(2)SH
8850 11508 MT
(Figure 2-3:)
SH( Example)
550 W( of use of sv_putrow)SH
53450 XM
(6)SH
8850 12676 MT
(Figure 2-4:)
SH( Example)
550 W( of rle_getrow use.)SH
53450 XM
(7)SH
8850 13844 MT
(Figure 2-5:)
SH( Program)
550 W( to produce a negative of an image)SH
53450 XM
(8)SH
ES
%%Trailer
%%Pages: 12
%%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol Courier-Bold